package com.wutong.common_server.result;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.io.Serializable;
import java.util.List;

/**
 * 分页结果封装对象
 * @author Steven
 *
 */
@Getter
@Setter
@NoArgsConstructor
public class PageResult<T> implements Serializable {

    private static final long serialVersionUID = -8573855566812280377L;

    private long total;//总记录数
    private List<T> rows;//当前页结果


    public PageResult(Page<T> list) {
        if (list.getSize() > 0) {
            this.rows = list.getRecords();
            this.total = list.getTotal();
        }
    }

}
